Overview of the Toolchange process
Terminology:
- Toolchange
- refers to the process where the tool required by the current program is inserted into the spindle. Toolchange can be either manual, or automatic, for instance by using a tool changer, like a rotatable carousel or turret to hold tools, and an arm mechanism to remove/insert tools and place them back into a pocket
- Pocket
- a numbered place in a tool changer, to hold a tool.
- Prepare
- moving a tool changers position so a given pocket is accessible to the change arm mechanism. The reason while prepare is a separate step from the actual change is that on some changers, prepare can run in parallel with machining which might save time.
- Non-random tool changer
- a type of changer where the current tool is unloaded into an empty pocket, the changer moved to the pocket holding the new tool, and the new tool is loaded from this pocket.
- Random tool changer
- a type of changer where the current tool is exchanged with the tool in the prepared pocket.
- Tool number
- unique identification for a tool. Depending on mechanism, a tool number might or might not identify a pocket. In the case of a random toolchanger, the tool table holds the mapping from tool number to pocket number; on tool change, the tool table is updated to reflect the tool's new pocket position.
Tool changing in EMC
EMC employs the iocontrol component to support a variety of different tool change process. iocontrol provides a range of pins to signal and handshake prepare and change operations, and to communicate tool and pocket numbers to a tool changer. It has specific support for random toolchangers if the RANDOM_TOOLCHANGER option is set in EMCIO.
The tool changer may be actual hardware connected to HAL lines, or a program mapping between hardware and iocontrol lines, for instance a ladder program, or Python script. In the case of a manual toolchanger, it would typically be a script like hal_manualtoolchange . In a simulated environment, it might make sense to disable the external toolchanger completely and "fake" immediate prepare and change completion by looping the tool-prepare and tool-prepared lines, and the tool-change and tool-changed lines respectively.
Prepare operation
The prepare operation is initiated by a T<toolnumber> command. This toolnumber is used in a later change step as the M6 command carries no tool number attribute by itself.
The following signals support the prepare step
- tool-prep-number: out,s32: the tool number to prepare
- tool-prep-pocket: out,s32: the commanded pocket number to position the toolchanger to. Valid only when RANDOM_TOOLCHANGER is set. The tool table is searched for the given tool number, the corresponding pocket number is retrieved and signaled with this pin.
- tool-prepare: out, bit: iocontrol signals to start a prepare.
- tool-prepared: in, bit: acknowledge line that the tool-prepare line has been noticed by the toolchanger, the tool-prep-number or tool-prep-pocket has been read if needed, and the prepare operation has been started (FIXME: or completed? this would defeat the purpose of running in parallel)
If a given toolchanger does not support prepare, or it is not needed (e.g. manual toolchange or simulator mode), these signals should be looped for immediate acknowledgement in HAL as follows:
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
Change operation
The change operation is initiated by an M6 command, which relies on the number of the tool to be loaded having been set by a previous T<toolnumber> command. When using a random toolchanger with prepare capability, it might make sense to execute the T<next-toolnumber> immediately after an M6 to give the prepare mechanism ample time to position. In nonrandom or manual toolchange scenarios this has no effect so T<toolnumber> and M6 could well be on the same line.
The following signals support the change step:
- tool-number: out,s32: the tool number currently loaded (in spindle).
- tool-change: out, bit: iocontrol signals to start a tool change operation.
- tool-changed: in, bit: acknowledge line that the tool-change line has been noticed by the toolchanger, the tool-number has been read if needed, and the change operation has completed.
If in a given setup the tool change step is not needed (e.g. simulator mode), these signals should be looped for immediate acknowledgement in HAL as follows:
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
The current Toolchanger protocol
Here's a diagram of a complete prepare and change cycle. It leaves out those pins which convey tool and pocket numbers because they are not relevant for handshaking.
Events:
- A T<toolnumber> command causes the tool-prep-number pin set to <toolnumber>. With the RANDOM_TOOLCHANGER option, the tool's pocket number is read from the tool table, and reflected in pin tool-prep-pocket. Then the tool-prepare pin is raised. This is to signal the toolchanger which tool/pocket is next. It is expected to acknowledge immediately that it got the number, even if actual preparations takes a long time. FIXME: is the last sentence correct?
- To acknowledge it got the tool number to prepare next, the toolchanger asserts the tool-prepared pin. FIXME - does tool-prepared=1 mean 'I got the pocket number' or 'I moved the carousel to this number'?
- iocontrol sees the tool-prepared pin at 1, and deasserts tool-prepare to acknowledge.
- The toolchanger sees tool-prepare going low and in response deasserts tool-prepared. The prepare cycle is now complete.
- An M6 command initiates the tool loading cycle. iocontrol asserts tool-change.
- The toolchanger completes the tool load and signals that with asserting tool-changed.
- iocontrol the tool-changed pin at 1, and deasserts tool-change to acknowledge.
- The toolchanger sees tool-change going low and in response deasserts tool-changed. The change cycle is now complete.
Note that the prepare cycle only communicates the next tool number, it does not wait for the actual preparation to complete. FIXME: correct? The T<toolnumber> command completes only after iocontrol sees the tool-prepared pin at 1.